import 'package:flutter/material.dart';
import 'package:flutter_public/tool/slide_page_route.dart';
import 'package:flutter_public/widget/image/assets_image.dart';

import '../activity_show_image_page.dart';

/// FileName gesture_assets_image
///
/// @Author lax
/// @Date 2024/3/19
///
/// @Description

class GestureAssetsImage extends StatelessWidget {
  final double? width;

  final double? height;

  final double? size;

  final double? radius;

  final String? path;

  final String? url;

  final String? name;

  final Color? bgColor;

  final Color? color;

  final BoxFit? fit;

  final EdgeInsets? margin;

  final EdgeInsets? padding;

  final Function()? onTap;

  final Function()? onLongPress;

  const GestureAssetsImage({
    super.key,
    this.width,
    this.height,
    this.size,
    this.radius,
    this.path,
    this.url,
    this.name,
    this.bgColor,
    this.color,
    this.fit = BoxFit.contain,
    this.margin,
    this.padding,
    this.onTap,
    this.onLongPress,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap ??
          () {
            Navigator.push(context, SlidePageRoute(builder: (_) {
              return ActivityShowImagePage(urlString: url);
            }));
          },
      onLongPress: onLongPress,
      child: AssetsImage(
        width: width,
        height: height,
        size: size,
        radius: radius,
        path: path,
        url: url,
        name: name,
        bgColor: bgColor,
        color: color,
        fit: fit,
        margin: margin,
        padding: padding,
      ),
    );
  }
}
